# -*- coding: utf-8 -*-
import schedule

from crawler.logger.log import logger
from scheduler.create_task_from_db.rabbitmq_script import CreateTask
from scheduler.create_task_from_db.setting import INTERVAL_SECONDS


if __name__ == '__main__':
    count = 1


    def worker():
        global count
        ct = CreateTask()
        logger.info(f'第{count}次推送任务')
        ct.run()
        count += 1

    schedule.every(INTERVAL_SECONDS).seconds.do(worker)
    while True:
        schedule.run_pending()
